const express = require("express");
const cors = require("cors");
const path = require("path");

module.exports = (app) => {
    // 设置静态 资源目录
    app.use(
        "/uploads",
        express.static(path.resolve(__dirname, "../../uploads"))
    );
    // 安全保护
    // 跨域配置
    app.use(
        cors({
            origin: "http://localhost:4000",
            credentials: true
        })
    );
    // 解析请求体
    app.use(express.json());
    app.use(express.urlencoded({ extended: false }));
    // 响应时间头
    // 响应压缩
};
